set(glut_directory glut-3.7)

if(CMAKEPORTS_ASSEMBLE)
    # This section is used only in CMakePorts SVN
    set(glut_directory ${glut_directory} PARENT_SCOPE)
    set(glut_tarball   glut-3.7.tar.gz PARENT_SCOPE)
    set(glut_url http://www.opengl.org/resources/libraries/glut/glut-3.7.tar.gz PARENT_SCOPE)
    set(glut_patches
        glut-3.7_cmp.diff
        PARENT_SCOPE)
endif()

if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${glut_directory}")
    add_subdirectory(${glut_directory})
endif()

# Compatibility settings for interoperability with FindGlut.cmake
set(GLUT_FOUND 1 CACHE INTERNAL "Found Glut")
set(GLUT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${glut_directory}/src CACHE INTERNAL "Glut include dir")
set(GLUT_LIBRARY   ${CMAKEPORTS_NAME_PREFIX}glut32 CACHE INTERNAL "Glut Library")
set(GLUT_LIBRARIES ${CMAKEPORTS_NAME_PREFIX}glut32 CACHE INTERNAL "Glut Libraries")
set(NATIVE_GLUT_LIB_PATH ${CMAKE_BINARY_DIR}/ports/glut/${glut_directory} CACHE INTERNAL "deprecated")
